﻿using RBAC.Repository.RabbitInterfae;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Traceability.Domain;
using Traceability.Service.Interfae;

namespace Traceability.Service.Impl
{
    public class DeepEnterprisService : IDeepEnterprisService
    {
        private readonly IDeepEnterprisesRepository _DeepEnterprisesrepository;
        public DeepEnterprisService(IDeepEnterprisesRepository deepEnterprisesrepository)
        {
            _DeepEnterprisesrepository = deepEnterprisesrepository;
        }
        /// <summary>
        /// 添加深加工企业信息
        /// </summary>
        /// <param name="deepEnterprises"></param>
        /// <returns></returns>
        public async Task<int> CreateDeepEnterpris(DeepEnterprises deepEnterprises)
        {
            return await _DeepEnterprisesrepository.AddAsync(deepEnterprises);
        }
        /// <summary>
        /// 反填深加工企业信息
        /// </summary>
        /// <param name="DeepEnterprisesId"></param>
        /// <returns></returns>
        public async Task<DeepEnterprises> GetDeepEnterprisesBy(int DeepEnterprisesId)
        {
          return await _DeepEnterprisesrepository.GetModelsAsync(DeepEnterprisesId);
        }
        /// <summary>
        /// 显示深加工企业信息
        /// </summary>
        /// <param name="bacth"></param>
        /// <returns></returns>
        public async Task<List<DeepEnterprises>> GetDeepEnterprisesList(string bacth)
        {
            return await _DeepEnterprisesrepository.GetAsync(d => d.DeepEnterprisesBatch == bacth);
        }
        /// <summary>
        /// 修改深加工企业信息
        /// </summary>
        /// <param name="deepEnterprises"></param>
        /// <returns></returns>
        public async Task<int> UpdateDeepEnterprises(DeepEnterprises deepEnterprises)
        {
            return await _DeepEnterprisesrepository.UpdateAsync(deepEnterprises);
        }
    }
}
